home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Classes
/
RCString
/
chart2.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
812b
|
36 lines
// testing of more of the Characters category.
#import <stdio.h>
#import <stdlib.h>
#import <signal.h>
#import <fcntl.h>
#import <string.h>
#import <sys/time.h>
#import <RCString.h>
int
main(int c, char **v)
{
RCString *oString;
int iChar, iIndex;
// args assumed to be: cmd string char index
iChar = *v[2];
iIndex = atoi(v[3]);
oString = [RCString newFromString:v[1]];
if (oString) {
printf("substituting %c at index %d into \"%s\": \"%s\"\n",
iChar, iIndex, v[1],
[[oString substituteCharacter:iChar at:iIndex] data]);
printf("inserting %c at index %d into \"%s\": \"%s\"\n",
iChar, iIndex, v[1],
[[[oString replaceWithAsciiString:v[1]] insertCharacter:iChar at:iIndex] data]);
[oString free];
} else {
fprintf(stderr, "newFromString: failure\n");
return(1);
}
return(0);
}